let obj = {
    name:'zhangsan',
    age:18,
    like:{
        a:'唱',
        b:'跳',
        c:'rap'
    },
    a:undefined,
    b:null,
    c:function(){
        console.log('我是一个函数')
    }
}

function deepClone(obj){
    let newObj = {}
    for(let key in obj){
        if(obj.hasOwnProperty(key)){
            if(typeof obj[key] === 'object' && obj[key] !== null){
                newObj[key] = deepClone(obj[key])
            }else{
                newObj[key] = obj[key]
            }
        }
    }
    return newObj;
}

let obj2 = deepClone(obj)
obj2.like.d = '篮球'
console.log(obj)
console.log(obj2)
obj2.c()
